<?php
$arr = [10,8,3,4,1,6,9];

for ($i=0;$i<count($arr)-1;$i++){

       for ($m=0;$m<(count($arr)-1)-$i;$m++){

              if($arr[$m] > $arr[$m+1]){
                     $value = $arr[$m];
                     $arr[$m] = $arr[$m+1];
                     $arr[$m+1] = $value;
              }

       }

}

echo "<pre>";
    var_dump($arr);  // 1,3,4,6,8,9,10
echo "</pre>";